Modify The Http Status In Mule 4

 

In this tutorial we will demonstrate how can we modify the Http status In Mule 4

To modify the status we have created a sample Rest API in mulesoft and deploy the same on local environment Please visit how to create Rest API

 

Sample Mulesoft application:

 

 

Deploy the mulesoft application and test without setting the HttpStatus hence it will send the HttpStatus as 500 Internal Server Error as we are testing with wrong empId

 

Now if you want to change the HttpStatus from 500 to 400(Bad Request), Please follow the below step

Add the variable under on error propagate and give the name of the variable as httpStatus and value as 400

Modify The Http Status In Mule 4

 

Deploy the application and test

Modify The Http Status In Mule 4

 

Sample application: change http status sample application

Soapui project: ChangeHttpStatus-soapui-project

 

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
abc@xyz.com
3 years ago

Thanks

arun
arun
1 year ago

This is a great example. Thank you.